package try_codes.p1;

import java.util.HashMap;
import java.util.Random;

public class P1 {
    public static void main(String[] args) {
        HashMap<Integer, Integer> hashMap = getCrimals();
        System.out.println(hashMap);
        int size = hashMap.size();
        int count=0;
        while (size>1){
            size=size/2;
            count++;
        }
        int pow = (int) Math.pow(2, count);
        System.out.println("幸存者:"+hashMap.get(pow));

    }

    private static HashMap<Integer, Integer> getCrimals() {
        HashMap<Integer,Integer> hashMap=new HashMap<>();
        Random random=new Random();
        int index=1;
        while (hashMap.size()<100){
            int num = random.nextInt(200)+1;
            if (!hashMap.containsValue(num)){
                hashMap.put(index,num);
                index++;
            }
            //System.out.println(index-1+" "+num);
        }
        return hashMap;
    }

}
